<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>日历</title>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
	<script src="/admin/public/html5shiv.min.js"></script>
	<script src="/admin/public/respond.min.js"></script>
<![endif]-->
<link href="/admin/public/bootstrap.min.css" title="" rel="stylesheet" />
<link href="/admin/font-awesome/css/font-awesome.min.css"
	rel="stylesheet" />
<link href="/admin/public/animate.css" rel="stylesheet" />
<link rel="stylesheet" href="/admin/public/inspinia.css" />
<link rel="stylesheet" href="/admin/css/pop-up.css" />
<link rel="stylesheet" href="/admin/css/plugins/toastr/toastr.min.css" />
<link rel="stylesheet" type="text/css" href="${request.getContext }/admin/css/xcConfirm.css" />
<link rel="stylesheet" type="text/css" href="/admin/calendar/easyui.css" />
<link href="/admin/css/plugins/datetimepicker/bootstrap-datetimepicker.min.css" rel="stylesheet" media="screen">
<link href="${request.getContext }/admin/newTemplate/css/plugins/select2/select2.min.css" rel="stylesheet"/>
<link href="${request.getContext }/admin/newTemplate/css/plugins/chosen/chosen.css" rel="stylesheet"/>
<style>
.calendar-body th, .calendar-body td{
	width:14%;
	height: 16%;
}
.calendar-body td{
 	position:relative;
}
.calendar-body td span:first-child {
 	  	font-size: 20px
}
.switch{
visibility:hidden;
}
.today{
	visibility:hidden;
}
 .calendar {
  	  	height: 1000px !important;
  	  	width: 100% !important;
  	  }
</style>

<script src="/admin/public/jquery-1.11.3.js"></script>
<script src="/admin/public/bootstrap.min.js" type="text/javascript"></script>
<script type="text/javascript" src="/admin/calendar/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="/admin/calendar/jquery.easyui.min.js"></script>
<script type="text/javascript" src="/admin/calendar/jquery.fullcalendar.js"></script>
<script src="/admin/js/plugins/datetimepicker/bootstrap-datetimepicker.min.js"></script>
<script src="/admin/js/plugins/toastr/toastr.min.js"></script>
<script src="/admin/js/new_page.js"></script>
<script src="/admin/js/plugins/datetimepicker/bootstrap-datetimepicker-update.min.js"></script>
<script src="/admin/js/plugins/datetimepicker/bootstrap-datetimepicker.zh-CN.js"></script>
<script src="/admin/public/artDialog4.1.7/artDialog.js?skin=blue"></script>
<script src="/admin/public/artDialog4.1.7/plugins/iframeTools.js"></script>
<script src="/admin/js/templet_form.js"></script>
<script src="/admin/js/plugins/lhgdialog/lhgdialog.js"></script>
<script src="${request.getContext }/admin/newTemplate/js/plugins/chosen/chosen.jquery.js"></script>
<script src="${request.getContext }/admin/newTemplate/js/plugins/select2/select2.full.min.js"></script>
</head>

<body style="overflow-x:auto;min-width:1700px;">
<div class="modal inmodal fade" id="myModal2" tabindex="-1" role="dialog" aria-hidden="true">
							<div class="modal-dialog modal-lg">
								<div  class="modal-content">
									<div class="modal-header">
										<input type="hidden" value="${minTime }" id="minTime"/>
										<input id="aaa" type="hidden" />
										<input type="hidden" value="${xlystartTime }" id="xlystartTime"/>
										<input type="hidden" value="${xlyendTime }" id="xlyendTime"/>
										<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
										<h5 class="modal-title">选择时间</h5>
									</div>
									<div class="modal-body">
										<div style="overflow:hidden;margin:10px 0;">
											<label for="" class="col-lg-2 col-md-2 col-sm-2 control-label">开始时间：</label>
											<div class="col-md-4 col-lg-4 col-sm-4">
												<div class="date input-append form_date ymd_date" style="float:left;margin-right:5px;">
													<div class="input-group">
														<input class="form-control input-sm" type="text" name="startTime" id="startTime">
														<span class="add-on input-group-addon">
							                            	<i class="fa fa-calendar" style="color:black;"></i>
							                            </span>
													</div>
												</div>
											</div>
											<span style="float: left;margin-top: 8px;">结束时间</span>
											<div class="col-md-4 col-lg-4 col-sm-4">
												<div class="date input-append form_date ymd_date"  style="float:left;margin-right:5px;">
													<div class="input-group">
														<input class="form-control input-sm" type="text" name="endTime" id="endTime">
														<span class="add-on input-group-addon"><i class="fa fa-calendar" style="color:black;"></i></span>
													</div>
												</div>
											</div>
										</div>
									</div>
									<div class="modal-footer">
										<button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
										<input value="" type="hidden" id="day"/>
										 <input type="button" id="plsure" style="display: none;" class="btn btn-primary" value="批量确定"  type="button" onclick="plschedulpk();"/> 
										<button type="button" id="sisure" class="btn btn-primary" onclick="schedulpk();">确定</button>
									</div>
								</div>
							</div>
						</div>
		<div class="top_tab_box" style="min-height: 300px; padding-bottom: 0px; margin-top: 20px;">
				<div class="wrapper wrapper-content">
			<div class="right_box">
				<div style="border: none; box-shadow: none;" class="right_one row">
					<div class="col-md-6 col-sm-6 col-xs-6" style="float: left;">
						<form class="form-horizontal" method="post" id="savecourses" novalidate="novalidate">
						<input type="hidden" name="shopId" id="shopId" value="${shop.shopId }">
							<div class="form-group">
								<label class="col-lg-2 control-label">门店名称:</label>
								<div class="col-lg-6">
									<input type="text" class="form-control" id="shopName"
										name="shopName" value="${shop.shopName }" readonly="readonly"/>
								</div>
							</div>
							
							<%-- <div class="form-group">
								<label class="col-lg-2 control-label">教练:</label>
								<div class="col-lg-6">
									<c:forEach items="${coachList }" var="item">
										<input type="checkbox" style="width: 60px"
											value="${item.userId }" name="userId" id="userId"/>
										<span>${item.realname }</span>
									</c:forEach>
								</div>
							</div> --%>
							<div class="form-group" >
								<label class="col-lg-2 control-label">教练:</label>
								<div class="col-lg-6">
									<select  name="userId" id="userId" data-placeholder="Choose a Country..." class="chosen-select" style="width:350px;" tabindex="2" style="z-index:105;!importamt">
					 					<option value="">--请选择--</option>
				 							<c:forEach items="${coachList }" var="user">
												<option value="${user.userId }">${user.realname }</option>
											</c:forEach>
								    </select>
								</div>
							</div>
							<input type="hidden" value="${coursesInfoId }" id="coursesInfoId">
							<div class="form-group" >
								<label class="col-lg-2 control-label">批量排课:</label>
								<div class="col-lg-6">
									<div class="col-lg-6">
										<input type="button" class="btn btn-primary" value="批量排课"  type="button" onclick="pl();"/>
										<button id="ss" style="display: none"  type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal2">选择时间	</button>
									</div>
								</div>
							</div>
							<hr/>
							<div class="form-group" >
								<label class="col-lg-2 control-label">按教练检索:</label>
								<div class="col-lg-6">
									<%-- <select onchange="selshe();" class="select2_demo_1 form-control" name="jsuserId"
										id="jsuserId">
										<option value="">--请选择--</option>
										<c:forEach items="${coachList }" var="user">
											<option value="${user.userId }">${user.realname }</option>
										</c:forEach>
									</select> --%>
									<select onchange="selshe();" name="jsuserId" id="jsuserId" data-placeholder="Choose a Country..." class="chosen-select" style="width:350px;" tabindex="2" style="z-index:105;!importamt">
					 					<option value="">--请选择--</option>
				 							<c:forEach items="${coachList }" var="user">
												<option value="${user.userId }">${user.realname }</option>
											</c:forEach>
								    </select>
								</div>
							</div>
						</form>
					</div>
					<div class="col-md-12 col-sm-12 col-xs-12 easyui-layout">
						<div class="membder-background addMemo-body">
							<div class="addMemo" id="iframe">
								<label>日期</label><input type="text" value="2015-10-10"  id="J-xl"/>
								<div class="clear-both"></div>
								<iframe src="iframe.html" width="100%" height="600" id="iframepage" name="iframe" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"></iframe>    
							</div>		
						</div>
						<div region="center">
							<div class="easyui-fullCalendar" fit="true"></div>
						</div>
					</div>
				</div>
				
			</div>
		</div>
	</div>
	<!-- 日历-->
	
										<!-- 弹框 -->
				<div class="modal inmodal fade" id="myModal5" tabindex="-1" role="dialog"  aria-hidden="true">
                      <div class="modal-dialog modal-lg">
                          <div class="modal-content">
                              <div class="modal-header">
                                  <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                                  <h4 class="modal-title" id="biaoti"></h4>
                              </div>
                              <div class="modal-body">
                                <form id="plshform" style="margin:10px 15px 20px 15px;">
				<table class="table-a" style="width:800px;" id="detail">
					<tbody>
						<tr>
								<th>开始时间</th>
								<th>训练营名称</th>
								<th>教练</th>
								<th>场地名称</th>
								<th>操作</th>
						</tr>
					</tbody>
				</table>
			</form>
                              </div>
                          </div>
                      </div>
                  </div>
	
<script>
//页面加载排课回显
$(function(){
	//日历变灰
	/*  var content=$("#dataTable span");
	var xlystartTime=$("#xlystartTime").val();//开始时间
	var xlyendTime=$("#xlyendTime").val();//结束时间
	var zhi=xlystartTime.split("-")[2];
	var endTime=xlyendTime.split("-")[2];
 	  // var zu[]=xlystartTime.split("-");
	 for(var i=0;i<content.length;i++){
		if($(content[i]).html()*1>=zhi*1&&$(content[i]).html()<=endTime){
			
		}else{
			 $(content[i]).css("color","#ccc");
			 $(content[i]).parent().unbind();
			 

		}
		
		
		
	}  */
	
	 	var trs=$('#dataTable tbody tr');
	 
		for(var j=0;j<trs.length;j++){
	   			$(trs[j]).each(function () { 
	   	                $(this).children('td').each(function () {  
	   		                   var td = $(this);
	   			               var content = td.attr('abbr');
	   			            console.log(content);
	   			         var xlystartTime=$("#xlystartTime").val();//开始时间
						var xlyendTime=$("#xlyendTime").val();//结束时间
	   			            var start=new Date(xlystartTime.replace("-", "/").replace("-", "/"));  
	   			            var end=new Date(xlyendTime.replace("-", "/").replace("-", "/"));  
	   			            var con=new Date(content.replace("-", "/").replace("-", "/"));  
	   			            if(con>=start&&con<=end){  
	   			            	
	   			            }else{
	   			             $(this).css("color","#ccc");
	   						 $(this).unbind();
	   			            }  
	   			     		
	   			     		
	   			               
	   			               
	   		            });
	   	            });
	   	     } 
	   	 /*  var xlystartTime=$("#xlystartTime").val();//开始时间
	   		var xlyendTime=$("#xlyendTime").val();//结束时间
	   	  var d1 = new Date(xlystartTime.replace(/\-/g, "\/"));  
	   	  var d2 = new Date(xlyendTime.replace(/\-/g, "\/"));  
	   	   if(xlystartTime!=""&&xlyendTime!=""&&d1 >=d2)  
	   	  {  
	   	   alert("开始时间不能大于结束时间！");  
	   	   return false;  
	   	  }else{
	   		  alert("通过了");
	   		  return true;
	   	  } */
})
//点击td显示时间控件
function timeshow(q){
	$("#day").val(q)
	$("#ss").click();//日期按钮
	
}
	//单个排课排课操作
	function schedulpk(){
	 	 var shopId = $("#shopId").val();
		if(shopId.length==0){
			alertNew("请选择门店！！！")
			return false;
		}
		
		var spCodesTemp= $("#userId option:selected").val();
		if(spCodesTemp==""){
			alertNew("请选择教练！！！")
			return false;
		}
		
		var dayTime = $("#day").val();
		var week = weeks(dayTime);
		var startTime = $("#startTime").val();
		if(startTime.length==0){
			alertNew("请选择要排的开始时间！！！")
			return false;
		}
		startTime =dayTime+" "+startTime;
		var endTime = $("#endTime").val();
		if(endTime.length==0){
			alertNew("请选择要排的结束时间！！！")
			return false;
		}
		endTime =dayTime+" "+endTime;
		    $.ajax({
				type : "post",
				data : { "shopId":shopId,"userId":spCodesTemp,"coursesInfoId":$("#coursesInfoId").val(),"startTime":startTime,"endTime":endTime,"dayTime":dayTime,"weeks":week },
				dataType : "json",
				url : "/courses/XLYschedulpk",
				success : function(data) {
					if(data.success){
						window.location.href="/courses/xlypk?coursesInfoId="+$("#coursesInfoId").val()+"&minTime="+$("#minTime").val()+"&xlystartTime="+$("#xlystartTime").val()+"&xlyendTime="+$("#xlyendTime").val();
					}
					alertNew(data.msg)
				},
				error : function(data) {
					alert("获取失败");
				}
			});    
	}

	//批量排课
	function plschedulpk(){
	 	var shopId = $("#shopId").val();
		if(shopId.length==0){
			alertNew("请选择门店！！！")
			return false;
		}
		var spCodesTemp = "";
	      $('#userId option:selected').each(function(i){
	       if(0==i){
	        	spCodesTemp = $(this).val();
	       }else{
	        	spCodesTemp += (","+$(this).val());
	       }
	      });
		if(spCodesTemp.length==0){
			alertNew("请选择教练！！！")
			return false;
		}
		
		var ncoursesInfoId = $("#coursesInfoId").val();
		
		var startTime1 = $("#startTime").val();
		if(startTime1.length==0){
			alertNew("请选择要排的开始时间！！！")
			return false;
		}
		var endTime1 = $("#endTime").val();
		if(endTime1.length==0){
			alertNew("请选择要排的结束时间！！！")
			return false;
		}
		var checkedNum = $("#dataTable input[name='che']:checked").length;
	    if(checkedNum==0){
	    	alertNew("请至少选择一项排课日期!");
	        return false;
	    }
		//所有日期
		 var checkedList = new Array();
	     $("input[name='che']:checked").each(function(){
	    	var rq = $(this).parent("td").attr('abbr');
	    	var startTime = rq+" "+startTime1;
	    	var endTime = rq+" "+endTime1;
			var week = weeks(rq);
	        checkedList.push({
	        	dayTime: rq,
	        	weeks:week,
	        	startTime:startTime,
	        	endTime:endTime,
	        	shopId:shopId,
	        	userId:spCodesTemp,
	        	coursesInfoId:ncoursesInfoId
	        });
	    });
			    $.ajax({
					type : "post",
					data : {"checkedList":JSON.stringify(checkedList) },
					dataType : "json",
					url : "/courses/XLYplschedulpk",
					success : function(data) {
						if(data.success){
							window.location.href="/courses/xlypk?coursesInfoId="+$("#coursesInfoId").val()+"&minTime="+$("#minTime").val()+"&xlystartTime="+$("#xlystartTime").val()+"&xlyendTime="+$("#xlyendTime").val();
						}
						alertNew(data.msg)
					},
					error : function(data) {
						alert("获取失败");
					}
				});     
	}
//查看训练营详情
function info(coursesId){
	//alert(coursesId)coursesId
	var minTime = $("#minTime").val();
	var xlystartTime = $("#xlystartTime").val();
	var xlyendTime = $("#xlyendTime").val();
	$.dialog({
		title : '课程相关信息',
		width : 800,
		height : 480,
		lock:true,
		content : 'url:/courses/alertModel?coursesId='+coursesId+'&panduan='+1+"&minTime="+minTime+"&xlystartTime="+xlystartTime+"&xlyendTime="+xlyendTime,
		init : function() {
		var iframe = this.iframe.contentWindow;
		var ul = iframe.document.getElementById('');
	},
	button : [
		{
			name : '修改',
			callback : function() {
			var iframe = this.iframe.contentWindow;
			var btn = iframe.document.getElementById('tijiao').click();
				if (btn == true) {
					
				} else {
					
					return false;
				}
			},
			focus : true	

		}, {
				name : '取消',
				callback : function() {

				}
			} 
	]
	});
	
}



//显示星期几
 function weeks(dayTime){
	var day = new Date(Date.parse(dayTime));   //需要正则转换的则 此处为 ： var day = new Date(Date.parse(date.replace(/-/g, '/')));  
	 var today = new Array('星期日','星期一','星期二','星期三','星期四','星期五','星期六');  
	 var week = today[day.getDay()]; 
	 return week;
}
//显示时分
$(".ymd_date").datetimepicker({　
		startView:1,
		format: "hh:ii",
		language: 'zh-CN',
		pickerPosition: "bottom-left",
		autoclose: false,
		todayBtn:true,
		minuteStep:5
	});
	/* 方法1
	for(var j=0;j<trs.length;j++){
			$(trs[j]).each(function () { 
	                $(this).children('td').each(function () {  
		                   var td = $(this);
			               var content = td.attr('abbr');
						  $.each(data.schedulList,function(i,item){
							 if(content==item.dayTime){
							 var aa = '<span style="color:red">'+item.coursesName+'</span><span style="color:green">开始时间'+item.startTime+'</span><span style="color:red">'+item.realname+'<span><br>';
								td.append(aa)
							 }
							
					     }) 
	                
		            });
	            });
	     }  */ 
  //加时间
    function addMin(minNumber, date) {
        date = date ? date : new Date();
        var ms = minNumber * (1000 * 60)
        var newDate = new Date(date.getTime() + ms);
        return newDate;
    }
     

    //对结束时间显示
    $('#startTime').change(function(){
    	var s = ($("#day").val()+" "+$('#startTime').val()).replace("-/g", "/");
    	var d = new Date(s)
    	var minTime = $("#minTime").val()
     	var date=addMin(minTime,d);
    	var hour = date.getHours();
    	var minute = date.getMinutes();
    	var endTime ="";
    	endTime +=hour+":";
    	endTime +=minute;
    	$("#endTime").val(endTime) 
    })
//将排课和日期对应上回显示
function selshe(){
    	var jsuserId=$("#jsuserId option:selected").val();
		//$("table").attr('id','dataTable');
		var trs=$('#dataTable tbody tr');
		var nowmonth=$('#aaa').val();
		//查询所有排课信息
		    $.ajax({
			type : "post",
			data : {"jsuserId":jsuserId,"nowmonth":nowmonth },
			dataType : "json",
			url : "/courses/findschedulXLY",
			success : function(data) {
				 var aa="";
				 var dat="";
				$("#dataTable .sp").remove();
 	    		for(var j=0;j<trs.length;j++){
 	   			$(trs[j]).each(function () { 
 	   	                $(this).children('td').each(function () {  
 	   		                   var td = $(this);
 	   			               var content = td.attr('abbr');
 	   			               var f=0;
 	   						  $.each(data.XLYschedulList,function(i,item){
 	   							 dat = zh(item.dayTime);
 	   							 if(content==dat){
 	   								 f++;
 	   								 if(f<3){
	 	   								aa= '<br class="sp"><span class="sp" onclick="info('+item.coursesId+')" style="color:green;font-size:12px">'+item.startTime+'-'+item.endTime+'</span>&nbsp&nbsp<span class="sp" onclick="info('+item.coursesId+')" style="color:red">'+item.coursesName+'</span>&nbsp&nbsp<span class="sp" onclick="info('+item.coursesId+')" style="color:red">'+item.realname+'</span>';
	 	   								td.append(aa)
 	   								 }
 	   							 }
 	   					     }) 
 	   					     
 	   					      if(f>=3){
 	   					    	td.append("<br class='sp' ><span class='sp' style='color:green;'><a onclick='gd(\""+content+"\")' data-toggle='modal' data-target='#myModal5'>>>更多</a></span>");  
 	   					     } 
 	   	                
 	   		            });
 	   	            });
 	   	     }
 	    		 
			}, 
			error : function(data) {
				alert("获取失败");
			}
		}); 
	}
    //点击更多查看全部训练营排课信息
    var format = function(time, format) {
		    var t = new Date(time);
		    var tf = function(i) {
		        return (i < 10 ? '0': '') + i
		    };
		    return format.replace(/yyyy|MM|dd|HH|mm|ss/g,
		    function(s0) {
		        switch (s0) {
		        case 'yyyy':
		            return tf(t.getFullYear());
		            break;
		        case 'MM':
		            return tf(t.getMonth() + 1);
		            break;
		        case 'mm':
		            return tf(t.getMinutes());
		            break;
		        case 'dd':
		            return tf(t.getDate());
		            break;
		        case 'HH':
		            return tf(t.getHours());
		            break;
		        case 'ss':
		            return tf(t.getSeconds());
		            break;
		        }
		    });
		}
    function gd(content){
    	$.ajax({
  		  type:"post",
  	        url:"/courses/lookInfo",
  	        data:{"dayTime":content},
  	        datatype:"json",
  	        success:function(data){
	        	var startTime;
	        	$(".tr1").empty();
	        	$("#biaoti").empty();
				var tr="";
	        	$.each(data.list,function(i,item){
	        		startTime=format(item.startTime,'HH:mm');
					tr+="<tr class='tr1'>";
					tr+="<td>"+startTime+"</td>";
					tr+="<td>"+item.coursesName+"</td>";
					tr+="<td>"+item.realname+"</td>";
					tr+="<td>"+item.shopName+"</td>";
					tr+="<td><a onclick='info("+item.coursesId+")'>详情</a></td>";
					tr+="</tr>";
				});
	        	$("#detail").append(tr);
	        	$("#biaoti").append(content);
  	        },
  	        error:function(data){
  	        	 
  	        }
  		})
    }
	//批量排课添加checkbox
	
	
	function pl(){
		//日历变灰
		$("#day").val("2017-6-15");//给时间控件加个日期
	 	 var che=$("#dataTable input:checkbox").prop("name")
		 if(che==undefined){
			//$("table").attr('id','dataTable');
			var trs=$('#dataTable tbody tr');
			for(var z=0;z<trs.length;z++){
	   	                 $(trs[z]).children('td').each(function () {  
	   		                   var td = $(this);
	   			               var content = td.attr('abbr');
	   			            console.log(content);
	   			         var xlystartTime=$("#xlystartTime").val();//开始时间
						var xlyendTime=$("#xlyendTime").val();//结束时间
	   			            var start=new Date(xlystartTime.replace("-", "/").replace("-", "/"));  
	   			            var end=new Date(xlyendTime.replace("-", "/").replace("-", "/"));  
	   			            var con=new Date(content.replace("-", "/").replace("-", "/"));  
	   			            if(con>=start&&con<=end){  
	   			            	$(this).append('<input name="che" style="position:absolute;top:5px;left:5px;" type="checkbox"/>')
				 				$(this).unbind();
	   			            }else{
	   			            	
	   			            }  
	   			     		
	   			     		
	   			               
	   			               
	   		            });
		   	     } 
			$("#sisure").hide();//单个排课按钮
			$("#plsure").show();//批量排课按钮
			$("#ss").show();//显示调用时间控件按钮
		}else{
			$("#dataTable input:checkbox").remove();
			$("#sisure").show()//单个排课按钮
			$("#plsure").hide();//批量排课按钮
			$("#ss").hide();//隐藏调用时间控件按钮
		} 
	}
//动态查询所有课程
	/* $("select[name='coursesType']").change(function(){
		var coursesInfo= $("#coursesInfoId");
		var coursesType = $("#coursesType option:selected").val();
		  $.ajax({
				type : "post",
				data : { "coursesType":coursesType },
				dataType : "json",
				url : "/courses/findcoursesByType",
				success : function(data) {
					coursesInfo.empty();
					//拼串 
					var str='<option value="">--请选择--</option>'; 
				 	 $.each(data.coursesList,function(i,item){
				 		str+='<option value="'+item.coursesInfoId+','+item.minTime+'">'+item.coursesName+'</option>'; 
					}) 
					coursesInfo.append(str); 
				}, 
				error : function(data) {
					alert("获取失败");
				}
			}); 
	}) */
	//将此课程的上课时间赋值到隐藏域
	/* $("select[name='coursesInfoId']").change(function(){
		var ncoursesInfoId = $("#coursesInfoId").val();
		var minTime =ncoursesInfoId.substring(ncoursesInfoId.indexOf(",")+1,ncoursesInfoId.length);
		$("#minTime").val(minTime);
	}) */
		//将"2017-06-4"转为 "2017-6-4"(暂时不用)
	function zh(str){
		var splitStr = str.split("-");
		var year = splitStr[0];
		
		var month = parseInt(splitStr[1]);
		
		var day = parseInt(splitStr[2]);
		var newStr = year + "-" + month + "-" + day;
		return newStr;
	}
	var noResultsMatch = '没有匹配结果';
    var defaultChosenOptions = { no_results_text: noResultsMatch, width: '100%', allow_single_deselect: true, disable_search_threshold: 1, placeholder_text_single: ' ', placeholder_text_multiple: ' ', search_contains: true };
    
            var config = {
            '.chosen-select'           : {},
            '.chosen-select-deselect'  : {allow_single_deselect:true},
            '.chosen-select-no-single' : {disable_search_threshold:10},
            '.chosen-select-no-results': {no_results_text:'Oops, nothing found!'},
            '.chosen-select-width'     : {width:"95%"}
            }
        for (var selector in config) {
            $(selector).chosen(config[selector]);
        }
</script> 
</body>
</html>
